<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('班级上课记录列表')"/>
</head>
<body class="gray-bg">
<div class="tabs-container">
    <ul class="nav nav-tabs">
        <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">班级上课记录</a>
        </li>
        <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">学生上课记录</a>
        </li>
    </ul>
    <div class="tab-content">
        <div id="tab-1" class="tab-pane active">
            <div class="container-div">
                <div class="row">
                    <div class="col-sm-12 search-collapse">
                        <form id="formId">
                            <div class="select-list">
                                <ul>
                                    <li>
                                        <label>上课日期：</label>
                                        <input type="text" class="time-input" placeholder="请选择上课日期"
                                               name="startDate"/>
                                    </li>
                                    <li>
                                        <label>班级名称：</label>
                                        <input type="text" name="className"/>
                                    </li>
                                    <li>
                                        <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('formId','bootstrap-table')"><i
                                                class="fa fa-search"></i>&nbsp;搜索</a>
                                        <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('formId','bootstrap-table')"><i
                                                class="fa fa-refresh"></i>&nbsp;重置</a>
                                    </li>
                                </ul>
                            </div>
                        </form>
                    </div>
                    <!--            <div class="btn-group-sm" id="toolbar" role="group">-->
                    <!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="teaching:classRecord:add">-->
                    <!--                    <i class="fa fa-plus"></i> 添加-->
                    <!--                </a>-->
                    <!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="teaching:classRecord:edit">-->
                    <!--                    <i class="fa fa-edit"></i> 修改-->
                    <!--                </a>-->
                    <!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="teaching:classRecord:remove">-->
                    <!--                    <i class="fa fa-remove"></i> 删除-->
                    <!--                </a>-->
                    <!--                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="teaching:classRecord:export">-->
                    <!--                    <i class="fa fa-download"></i> 导出-->
                    <!--                </a>-->
                    <!--            </div>-->
                    <div class="col-sm-12 select-table table-striped">
                        <table id="bootstrap-table"></table>
                    </div>
                </div>
            </div>
        </div>
        <div id="tab-2" class="tab-pane">
            <div class="container-div">
                <div class="row">
                    <div class="col-sm-12 search-collapse">
                        <form id="formId2">
                            <div class="select-list">
                                <ul>
<!--                                    <li>-->
<!--                                        <label>上课日期：</label>-->
<!--                                        <input type="text" class="time-input" placeholder="请选择上课日期"-->
<!--                                               name="teachingClassesRecord.startDate"/>-->
<!--                                    </li>-->
                                    <li>
                                        <label>班级名称：</label>
                                        <input type="text" name="className"/>
                                    </li>
                                    <li>
                                        <label>学生名称：</label>
                                        <input type="text" name="studentName"/>
                                    </li>
                                    <li>
                                        <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('formId2','student-table')"><i
                                                class="fa fa-search"></i>&nbsp;搜索</a>
                                        <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('formId2','student-table')"><i
                                                class="fa fa-refresh"></i>&nbsp;重置</a>
                                    </li>
                                </ul>
                            </div>
                        </form>
                    </div>
                    <!--            <div class="btn-group-sm" id="toolbar" role="group">-->
                    <!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="teaching:classRecord:add">-->
                    <!--                    <i class="fa fa-plus"></i> 添加-->
                    <!--                </a>-->
                    <!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="teaching:classRecord:edit">-->
                    <!--                    <i class="fa fa-edit"></i> 修改-->
                    <!--                </a>-->
                    <!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="teaching:classRecord:remove">-->
                    <!--                    <i class="fa fa-remove"></i> 删除-->
                    <!--                </a>-->
                    <!--                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="teaching:classRecord:export">-->
                    <!--                    <i class="fa fa-download"></i> 导出-->
                    <!--                </a>-->
                    <!--            </div>-->
                    <div class="col-sm-12 select-table table-striped">
                        <table id="student-table"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('teaching:classRecord:edit')}]];
    var editFlag1 = [[${@permission.hasPermi('teaching:record:edit')}]];
    var removeFlag = [[${@permission.hasPermi('teaching:classRecord:remove')}]];
    var removeFlag1 = [[${@permission.hasPermi('teaching:record:remove')}]];
    var prefix = ctx + "teaching/classRecord";
    var data1 = [[${@dict.getType('sys_attend_Status')}]];

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "班级上课记录",
            sortName: "claRecordId",
            sortOrder: "desc",
            columns: [{
                checkbox: false,
                visible: false
            },
                {
                    field: 'claRecordId',
                    title: '班级记录ID',
                    visible: false
                },
                {
                    field: 'schoolId',
                    title: '学校ID',
                    visible: false
                },
                {
                    field: 'courseId',
                    title: '课程ID',
                    visible: false
                },
                {
                    field: 'teacherId',
                    title: '教师ID',
                    visible: false
                },
                {
                    field: 'classId',
                    title: '班级ID',
                    visible: false
                },
                {
                    field: 'startDate',
                    title: '上课日期',
                    formatter: function (value, row, index) {
                        return $.common.dateFormat(row.startDate, 'yyyy-MM-dd');
                    }
                },
                {
                    title: '上课时段',
                    formatter: function (value, row, index) {
                        return $.common.dateFormat(row.startDate + ' ' + row.startTime, 'HH:mm') + '-' + $.common.dateFormat(row.startDate + ' ' + row.endTime, 'HH:mm');
                    }
                },
                {
                    field: 'className',
                    title: '班级名称'
                },
                {
                    field: 'teachingCourse.name',
                    title: '课程名称'
                },
                {
                    field: 'teacherName',
                    title: '老师名称'
                },
                {
                    title: '实到/应到',
                    formatter: function (value, row, index) {
                        return row.attendance + '/' + row.peopleCount;
                    }
                },
                {
                    field: 'attendance',
                    title: '到课人数'
                },
                {
                    field: 'leaveCount',
                    title: '请假人数'
                },
                {
                    field: 'truantCount',
                    title: '旷课人数'
                },
                {
                    field: 'studentHour',
                    title: '学生课时'
                },
                {
                    field: 'teacherHour',
                    title: '老师课时'
                },
                {
                    field: 'status',
                    title: '状态',
                    visible: false
                },
                {
                    field: 'createId',
                    title: '创建者ID',
                    visible: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="editModal(\'' + row.claRecordId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.claRecordId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function editModal(claRecordId) {
        var url = ctx + 'teaching/classRecord/editModal/' + claRecordId;
        $.modal.openTab("编辑", url);
    }

    $(function () {
        var options = {
            id: 'student-table',
            url: ctx + "teaching/record/list",
            createUrl: ctx + "teaching/record/add",
            updateUrl: ctx + "teaching/record/edit/{id}",
            removeUrl: ctx + "teaching/record/remove",
            exportUrl: ctx + "teaching/record/export",
            modalName: "学生上课记录",
            sortName: "recordId",
            sortOrder: "desc",
            columns: [{
                checkbox: false,
                visible: false
            },
                {
                    field: 'recordId',
                    title: '记上课ID',
                    visible: false
                },
                {
                    field: 'claRecordId',
                    title: '班级记录ID',
                    visible: false
                },
                {
                    field: 'classStudentId',
                    title: '班级学员ID',
                    visible: false
                },
                {
                    field: 'applyId',
                    title: '报课ID',
                    visible: false
                },
                {
                    field: 'schoolId',
                    title: '学校ID',
                    visible: false
                },
                {
                    field: 'classId',
                    title: '班级ID',
                    visible: false
                },
                {
                    field: 'scheduleId',
                    title: '排班ID',
                    visible: false
                },
                {
                    field: 'teachingClassesRecord.startDate',
                    title: '上课日期',
                    formatter: function (value, row, index) {
                        return $.common.dateFormat(row.teachingClassesRecord.startDate, 'yyyy-MM-dd');
                    }
                },
                {
                    title: '上课时段',
                    formatter: function (value, row, index) {
                        return $.common.dateFormat(row.teachingClassesRecord.startDate + ' ' + row.teachingClassesRecord.startTime, 'HH:mm') + '-' + $.common.dateFormat(row.teachingClassesRecord.startDate + ' ' + row.teachingClassesRecord.endTime, 'HH:mm');
                    }
                },
                {
                    field: 'studentName',
                    title: '学生姓名'
                },
                {
                    field: 'className',
                    title: '班级名称'
                },
                {
                    field: 'lessonConsume',
                    title: '已消耗课时'
                },
                {
                    field: 'leaveCount',
                    title: '请假次数',
                    visible: false
                },
                {
                    field: 'attendCount',
                    title: '到勤人数',
                    visible: false
                },
                {
                    field: 'attendStatus',
                    title: '到课状态',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(data1, value);
                    }
                },
                {
                    field: 'status',
                    title: '状态',
                    visible: false
                },
                {
                    field: 'createId',
                    title: '创建者ID',
                    visible: false
                },
                {
                    field: 'remark',
                    title: '备注',
                    visible: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag1 + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.recordId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag1 + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.recordId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>